Skip to content

fix(gql): Remove credentials and query values from the transport URL - #8227

Open
Mohil-Ahuja wants to merge 1 commit into
getsentry:masterfrom
Mohil-Ahuja:fix/gql-sanitize-transport-url
Open

Mohil-Ahuja wants to merge 1 commit into
getsentry:masterfrom
Mohil-Ahuja:fix/gql-sanitize-transport-url

Conversation

@Mohil-Ahuja

Copy link
Copy Markdown

Description

The gql integration copied transport.url into event["request"]["url"] unchanged, so credentials and query tokens in the URL were sent with every event, whatever send_default_pii was set to.

The URL now goes through parse_url. The authority is filtered in url, and the query goes to query_string.

One change from what I suggested in the issue: I kept parse_url's default sanitizing instead of sanitize=False. With sanitize=False, a token such as access_token=... would only move from url to query_string and still be sent. Query values are now always [Filtered], with the keys kept, even with send_default_pii=True. If you'd rather keep the values when PII is enabled, that's a small change.

The URL is passed through str() because some transports accept a URL object as well as a string. If parsing fails, url is left out of the event.

I ran tests/integrations/gql through tox on py3.10-gql-v3.4.1, py3.14-gql-v4.4.0 and py3.14-gql-latest, plus ruff and mypy. Without the change, the new sanitizing tests fail.

Issues

The integration copied transport.url into event["request"]["url"] unchanged,
so credentials and query tokens in the URL were sent with every event, whatever
send_default_pii was set to. Sanitize it with parse_url and send the filtered
query in query_string.
@Mohil-Ahuja
Mohil-Ahuja marked this pull request as ready for review November 9, 2026 09:35
@Mohil-Ahuja
Mohil-Ahuja requested a review from a team as a code owner November 9, 2026 09:35

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gql: transport URL is sent as request.url without removing credentials

1 participant